﻿@using System.Globalization
@model gnet1.Models.PushButtonGameViewModel
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>


@{
  ViewBag.Title = "Push Button Game";
}
<script>
  function DoSomething() {
    alert("Do Something");
  }

</script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<div id="column_M">
  <div style="text-align: center">
    <h2>Push Button Game</h2>
    @using (Html.BeginForm())
    {
      <div>
        <div class="editor-label ">
          @Html.LabelFor(model =>model.Name)
        </div>
        <div class="editor-field">
          @Html.TextBoxFor(model => model.Name)
          @Html.ValidationMessageFor(model => model.Name)
        </div>
      </div>
      <div>
         <div class="editor-label ">
           @Html.LabelFor(model => model.Email)
         </div>
         <div class="editor-field">
           @Html.TextBoxFor(model => model.Email)
           @Html.ValidationMessageFor(model => model.Email)
         </div>
       </div>      
      <br/>
      <br/>
      <div id="partial">
        <button type="submit" id="roundbutton">@Model.GetCounter().ToString(CultureInfo.InvariantCulture)</button>
      </div>
    }

  </div>
</div>


<script type="text/javascript">

  $(function () {
    $('form').submit(function () {
      if ($(this).valid()) {
        $.ajax({
          url: "_PushButton",
          type: this.method,
          data: $(this).serialize(),
          success: function (result) {
            $('#partial').html(result);
          }
        });
      }
      return false;
    });
  });

</script>
